<template>
  <div class="home_wrap">
    <div class="left">
        <img src="@/assets/img/logo2.jpg" alt="" />
        <div class="pingtai">会员积分管理平台</div>
    </div>
    <div class="right">
        <ul class="list">
            <li @click="theProblem">常见问题</li>
            <li @click="CenterofSafety">安全中心</li>
            <li @click="CustomerService">客服</li>
            <li @click="goLoin">{{info}}</li>
            <li @click="exit">退出</li>
        </ul>
    </div>
  </div>
</template>

<script>
export default {
  computed:{
    info(){
      return this.$store.state.user_name ? this.$store.state.user_name : "登录";
    },
  },
  methods:{
    goLoin(){
      //点击按钮转到登录页面
      console.log('gologin');
      //编程式路由导航跳转
      // this.$router.push({
      //   name:'login'
      // });
      if(!this.$store.state.user_name){
        this.$router.push({
          name:"login",
        });
      }else{
        this.$router.push({
          name:"personcenter",
        });
      }

    },
    //常见问题跳转
    theProblem(){
      console.log(666)
      this.$router.push({
          name:"problem",
        });
    },
     //安全中心跳转
    CenterofSafety(){
      this.$router.push({
          name:"safety",
        });
    },
    //客服跳转
    CustomerService(){
      this.$router.push({
          name:"service",
        });
    },
    exit(){
      localStorage.clear();
      sessionStorage.clear();
       //关闭当前页面并跳转页面
      window.open("about:blank","_self");
      window.close();
    },
  },

}
</script>

<style lang="scss" scoped>
.home_wrap {
  display: flex;
  justify-content: space-between;
  .left {
    display: flex;
    align-items: center;
    img {
      width: 100px;
      height: 100px;
      margin-right: 20px;
    }
    .pingtai {
      font-size: 30px;
      font-weight: 700;
      //   line-height: 130px;
      display: flex;
      align-items: center;
    }
  }
  .right {
    display: flex;
    align-items: flex-end;
    .list {
      display: flex;
      li {
        // list-style: none;
        font-size: 20px;
        font-weight: 800;
        padding-right: 10px;
      }
    }
  }
}
</style>